package com.example.demo555.service.impl;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo555.entity.Picture;
import com.example.demo555.mapper.PictureMapper;
import com.example.demo555.service.PictureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * <p>
 * 图床 服务实现类
 * </p>
 *
 * @author faiz
 * @since 2021-07-14
 */
@Service
public class PictureServiceImpl extends ServiceImpl<PictureMapper, Picture> implements PictureService {

    private final PictureMapper pictureMapper;

    @Autowired
    public PictureServiceImpl(PictureMapper pictureMapper) {
        this.pictureMapper = pictureMapper;
    }

    @Override
    public List<Picture> listTOpPictures() {
        QueryWrapper<Picture> wrapper = new QueryWrapper<>();
        wrapper.orderByAsc("id").last("limit 0, 10");
        return pictureMapper.selectList(wrapper);

    }

    @Override
    public int batchInsertPicture(List<Picture> pictureList) {
        return 0;
    }

    @Override
    public int insertPicture(Picture picture) {
        return 0;
    }

}
